Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbls: library for BLS12-381 abstraction #1692

Merged
merged 22 commits into from
Jan 30, 2023
Merged

Conversation

gsora
Copy link
Collaborator

@gsora gsora commented Jan 26, 2023

This PR adds a subpackage in tbls called v2, which is a new abstraction for BLS12-381 cryptography.

It contains two concrete implementations — one using Herumi and another based on Kryptology, added for backwards compatibility while we work out the migration.

A complete test suite is provided, alongside a fuzzing target to test cross-compatibility between implementation.

Preliminary tests show substantial performance improvements.

category: refactor
ticket: #1658

This commit also adds an example implementation of the BLS abstraction for Herumi's BLS library.

This code is not finished (missing testing, and many Godoc comments), and it is pushed as a request for comment from the team.
…cts.

The `taketwo` package is a placeholder, once we settle on an interface it will be all merged under `tbls`.
Just a thin wrapper over []byte, to favorite type safety.
Needed because Kryptology API requires it.
Missing ThresholdAggregate, Verify and Sign, plus tests.
Since we're trying to abstract library details, it makes sense to have a common set of tests, and something in place that allows us to run it by switching the underlying implementation.
This taketwo.Implementation takes a set of taketwo.Implementation's, and whenever one of the interface's method is called it takes one randomly.

This is useful for testing, since it can tell us whether a set of taketwo.Implementation's are compatible among themselves.
Helps with randomization/compatibility testing.
Once we migrate away from the original bls abstraction implementation, v2 package content will move to the root tbls package.
@gsora gsora requested a review from corverroos January 26, 2023 09:40
@gsora
Copy link
Collaborator Author

gsora commented Jan 26, 2023

Fixing linting issues as we speak.

@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Base: 54.31% // Head: 54.54% // Increases project coverage by +0.23% 🎉

Coverage data is based on head (c5c7160) compared to base (456b04f).
Patch coverage: 54.54% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1692      +/-   ##
==========================================
+ Coverage   54.31%   54.54%   +0.23%     
==========================================
  Files         158      161       +3     
  Lines       20339    20652     +313     
==========================================
+ Hits        11047    11265     +218     
- Misses       7807     7892      +85     
- Partials     1485     1495      +10     
Impacted Files Coverage Δ
tbls/v2/unimplemented.go 0.00% <0.00%> (ø)
testutil/compose/define.go 37.97% <0.00%> (-2.03%) ⬇️
tbls/v2/tbls.go 100.00% <100.00%> (ø)
p2p/bootnode.go 0.00% <0.00%> (-23.22%) ⬇️
cmd/enr.go 8.16% <0.00%> (-6.94%) ⬇️
app/eth2wrap/eth2wrap.go 51.87% <0.00%> (-4.59%) ⬇️
cluster/ssz.go 75.06% <0.00%> (-4.06%) ⬇️
app/eth2wrap/httpwrap.go 22.76% <0.00%> (-2.70%) ⬇️
core/consensus/msg.go 53.27% <0.00%> (-1.13%) ⬇️
... and 39 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gsora gsora changed the title tbls: BLS12-381 abstraction tbls: library for BLS12-381 abstraction Jan 26, 2023
go.mod Show resolved Hide resolved
tbls/v2/herumi/herumi.go Outdated Show resolved Hide resolved
tbls/v2/herumi/herumi.go Outdated Show resolved Hide resolved
tbls/v2/tbls.go Show resolved Hide resolved
@gsora gsora added the merge when ready Indicates bulldozer bot may merge when all checks pass label Jan 30, 2023
@obol-bulldozer obol-bulldozer bot merged commit 76b3942 into main Jan 30, 2023
@obol-bulldozer obol-bulldozer bot deleted the gsora/bls-abstraction branch January 30, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants